{% extends "base.html" %}

{% block title %}Register New Account{% endblock %}
{% block content %}
<div class="col-6">
	<form action="register.php?do=register" method="POST" id="login-form">
		<legend>Create Account</legend>
		<fieldset>
			{% if get.error is defined and get.error != 1 %}
				<div class="alert alert-danger"><i class="fa fa-warning"></i>
				{% if get.error == 'u_fail' %}
					The username you entered does not meet the requirements. Must be at least 4 characters, and no more than 35. Username can only contain a-zA-Z0-9_-
				{% elseif get.error == 'p_fail' %}
					The passwords you entered did not match or were not at least 8 characters.
				{% elseif get.error == 'a_fail' %}
					Account with that username or email already exists in the system.
				{% elseif get.error == 'xsrf' %}
					Invalid XSRF token submitted with the form.
				{% elseif get.error == 'token' %}
					No token was submitted with the request.
				{% elseif get.error == 't_fail' %}
					The token you submitted is not valid.
				{% else %}
					Undefined error occured.
				{% endif %}
				</div>
			{% endif %}
			<div class="well well-sm">
				<p>Welcome! Please fill out the form below to create an account and begin accessing servers. If you have already have an account please go to <code>Account Settings &rarr; Server Token</code> and add the token you have recieved and authenticate the request.</p>
			</div>
			<div class="form-group">
				<label for="login-password" class="control-label">Token</label>
				<div>
					<input type="text" class="form-control" name="token" id="token" {% if get.token is defined %}value="{{ get.token }}"{% endif %} />
					<p><small class="text-muted"><em>Please enter the token that you recieved in the email.</em></small></p>
				</div>
			</div>
			<hr />
			<div class="form-group">
				<label for="username" class="control-label">Username</label>
				<div>
					<input type="text" class="form-control" name="username" id="username" placeholder="Username" />
					<p><small class="text-muted"><em>Must be between 4 and 35 characters long. (a-zA-Z0-9_-)</em></small></p>
				</div>
			</div>
			<div class="form-group">
				<label for="password" class="control-label">{{ lang.string_password }}</label>
				<div>
					<input type="password" class="form-control" name="password" id="password" placeholder="{{ lang.string_password }}" />
				</div>
			</div>
			<div class="form-group">
				<label for="password_2" class="control-label">{{ lang.string_password }} Again</label>
				<div>
					<input type="password" class="form-control" name="password_2" id="password_2" placeholder="{{ lang.string_password }} Again" />
				</div>
			</div>
			<div class="form-group">
				<div>
					{{ xsrf|raw }}
					<input type="submit" class="btn btn-primary" value="Create Account" />
					<button class="btn btn-default" onclick="window.location='index.php';return false;">Login</button>
				</div>
			</div>
		</fieldset>
	</form>
</div>
<div class="col-3"></div>
{% endblock %}